<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Qi user guide</title>

<meta name="description" content="Qi user guide">
<meta name="keywords" content="Qi user guide">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="#Top" rel="start" title="Top">
<link href="#Index" rel="index" title="Index">
<link href="dir.html#Top" rel="up" title="(dir)">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en">
<h1 class="settitle" align="center">Qi user guide</h1>





<a name="Top"></a>
<div class="header">
<p>
Next: <a href="#Introduction-to-Qi" accesskey="n" rel="next">Introduction to Qi</a>, Up: <a href="dir.html#Top" accesskey="u" rel="up">(dir)</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="SEC_Top"></a>

<p>This user guide is for Qi (version 2.9-rc1,
16 May 2022).
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Introduction-to-Qi" accesskey="1">Introduction to Qi</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Description and features of qi
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Invoking-qi" accesskey="2">Invoking qi</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Command-line options
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#The-qirc-file" accesskey="3">The qirc file</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Configuration file
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Packages" accesskey="4">Packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Managing packages
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Recipes" accesskey="5">Recipes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Building packages
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Order-files" accesskey="6">Order files</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Handling build order
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Creating-packages" accesskey="7">Creating packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Making Qi packages
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Examining-packages" accesskey="8">Examining packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Debugging purposes
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Qi-exit-status" accesskey="9">Qi exit status</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Exit codes
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Index">Index</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<br>
<p>Copyright &copy; 2019-2022 Matias Andres Fonzo, Santiago del Estero,
Argentina.
</p>
<p>Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
</p>

<hr>
<a name="Introduction-to-Qi"></a>
<div class="header">
<p>
Next: <a href="#Invoking-qi" accesskey="n" rel="next">Invoking qi</a>, Previous: <a href="#Top" accesskey="p" rel="prev">Top</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Introduction-to-Qi-1"></a>
<h2 class="chapter">1 Introduction to Qi</h2>
<a name="index-introduction-to-qi"></a>

<p>Qi is a simple but well-integrated package manager.  It can create,
install, remove, and upgrade software packages.  Qi produces binary
packages using recipes, which are files containing specific instructions
to build each package from source.  Qi can manage multiple packages
under a single directory hierarchy.  This method allows to maintain a set
of packages and multiple versions of them.  This means that Qi could be
used as the main package manager or complement the existing one.
</p>
<p>Qi offers a friendly command line interface, a global configuration
file, a simple recipe layout to deploy software packages; also works
with binary packages in parallel, speeding up installations and packages
in production.  The format used for packages is a simplified and safer
variant of POSIX pax archive compressed in lzip format.
</p>
<p>Qi is a modern (POSIX-compliant) shell script released under the
terms of the GNU General Public License.  There are only two major
dependencies for the magic: graft(1) and tarlz(1), the rest is expected
to be found in any Unix-like system.
</p>
<hr>
<a name="Invoking-qi"></a>
<div class="header">
<p>
Next: <a href="#The-qirc-file" accesskey="n" rel="next">The qirc file</a>, Previous: <a href="#Introduction-to-Qi" accesskey="p" rel="prev">Introduction to Qi</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Invoking-qi-1"></a>
<h2 class="chapter">2 Invoking qi</h2>
<a name="index-invocation"></a>

<p>This chapter describes the synopsis for invoking Qi.
</p>
<div class="example">
<pre class="example">Usage: qi COMMAND [<var>OPTION</var>...] [<var>FILE</var>]...
</pre></div>

<p>One mandatory command specifies the operation that &lsquo;<samp>qi</samp>&rsquo; should
perform, options are meant to detail how this operation should be
performed during or after the process.
</p>
<p>Qi supports the following commands:
</p>
<dl compact="compact">
<dt><code>warn</code></dt>
<dd><p>Warn about files that will be installed.
</p>
</dd>
<dt><code>install</code></dt>
<dd><p>Install packages.
</p>
</dd>
<dt><code>remove</code></dt>
<dd><p>Remove packages.
</p>
</dd>
<dt><code>upgrade</code></dt>
<dd><p>Upgrade packages.
</p>
</dd>
<dt><code>extract</code></dt>
<dd><p>Extract packages for debugging purposes.
</p>
</dd>
<dt><code>create</code></dt>
<dd><p>Create a .tlz package from directory.
</p>
</dd>
<dt><code>build</code></dt>
<dd><p>Build packages using recipe names.
</p>
</dd>
<dt><code>order</code></dt>
<dd><p>Resolve build order through .order files
</p></dd>
</dl>

<p>Options when installing, removing, or upgrading software packages:
</p>
<dl compact="compact">
<dt><code>-f</code></dt>
<dt><code>--force</code></dt>
<dd><p>Force upgrade of pre-existing packages.
</p>
</dd>
<dt><code>-k</code></dt>
<dt><code>--keep</code></dt>
<dd><p>Keep directories when build/remove/upgrade.
</p>
<p>Keep (don&rsquo;t delete) the package directory when using remove/upgrade command.
</p>
<p>This will also try to preserve the directories &lsquo;<samp>${srcdir}</samp>&rsquo; and
&lsquo;<samp>${destdir}</samp>&rsquo; when using build command.  Its effect is available in
recipes as &lsquo;<samp>${keep_srcdir}</samp>&rsquo; and &lsquo;<samp>${keep_destdir}</samp>&rsquo;.  See
<a href="#Recipes">Special variables</a> for details.
</p>
</dd>
<dt><code>-p</code></dt>
<dt><code>--prune</code></dt>
<dd><p>Prune conflicts.
</p>
</dd>
<dt><code>-P</code></dt>
<dt><code>--packagedir=&lt;dir&gt;</code></dt>
<dd><p>Set directory for package installations.
</p>
</dd>
<dt><code>-t</code></dt>
<dt><code>--targetdir=&lt;dir&gt;</code></dt>
<dd><p>Set target directory for symbolic links.
</p>
</dd>
<dt><code>-r</code></dt>
<dt><code>--rootdir=&lt;dir&gt;</code></dt>
<dd><p>Use the fully qualified named directory as the root directory for all qi
operations.
</p>
<p>Note: the target directory and the package directory will be
relative to the specified directory, excepting the graft log file.
</p></dd>
</dl>

<p>Options when building software packages using recipes:
</p>
<dl compact="compact">
<dt><code>-a</code></dt>
<dt><code>--architecture</code></dt>
<dd><p>Set architecture name for the package.
</p>
</dd>
<dt><code>-j</code></dt>
<dt><code>--jobs</code></dt>
<dd><p>Parallel jobs for the compiler.
</p>
<p>This option sets the variable &lsquo;<samp>${jobs}</samp>&rsquo;.  If not specified, default
sets to 1.
</p>
</dd>
<dt><code>-S</code></dt>
<dt><code>--skip-questions</code></dt>
<dd><p>Skip questions on completed recipes.
</p>
</dd>
<dt><code>-1</code></dt>
<dt><code>--increment</code></dt>
<dd><p>Increment release number (&lsquo;<samp>${release}</samp>&rsquo; + 1).
</p>
<p>The effect of this option will be omitted if &ndash;no-package is being used.
</p>
</dd>
<dt><code>-n</code></dt>
<dt><code>--no-package</code></dt>
<dd><p>Do not create a .tlz package.
</p>
</dd>
<dt><code>-i</code></dt>
<dt><code>--install</code></dt>
<dd><p>Install package after the build.
</p>
</dd>
<dt><code>-u</code></dt>
<dt><code>--upgrade</code></dt>
<dd><p>Upgrade package after the build.
</p>
</dd>
<dt><code>-o</code></dt>
<dt><code>--outdir=&lt;dir&gt;</code></dt>
<dd><p>Where the packages produced will be written.
</p>
<p>This option sets the variable &lsquo;<samp>${outdir}</samp>&rsquo;.
</p>
</dd>
<dt><code>-w</code></dt>
<dt><code>--worktree=&lt;dir&gt;</code></dt>
<dd><p>Where archives, patches, recipes are expected.
</p>
<p>This option sets the variable &lsquo;<samp>${worktree}</samp>&rsquo;.
</p>
</dd>
<dt><code>-s</code></dt>
<dt><code>--sourcedir=&lt;dir&gt;</code></dt>
<dd><p>Where compressed sources will be found.
</p>
<p>This option sets the variable &lsquo;<samp>${tardir}</samp>&rsquo;.
</p></dd>
</dl>

<p>Other options:
</p>
<dl compact="compact">
<dt><code>-v</code></dt>
<dt><code>--verbose</code></dt>
<dd><p>Be verbose (an extra -v gives more).
</p>
<p>It sets the verbosity level, default sets to 0.
</p>
<p>The value 1 is used for more verbosity while the value 2 is too detailed.
Although at the moment it is limited to graft(1) verbosity.
</p>
</dd>
<dt><code>-N</code></dt>
<dt><code>--no-rc</code></dt>
<dd><p>Do not read the configuration file.
</p>
<p>This will ignore reading the qirc file.
</p>
</dd>
<dt><code>-L</code></dt>
<dt><code>--show-location</code></dt>
<dd><p>Print default directory locations and exit.
</p>
<p>This will print the target directory, package directory, working tree,
the directory for sources, and the output directory for the packages
produced.
</p>
</dd>
<dt><code>-h</code></dt>
<dt><code>--help</code></dt>
<dd><p>Display the usage and exit.
</p>
</dd>
<dt><code>-V</code></dt>
<dt><code>--version</code></dt>
<dd>
<p>This will print the (short) version information and then exit.
</p>
<p>The same can be achieved if Qi is invoked as &lsquo;<samp>qi version</samp>&rsquo;.
</p></dd>
</dl>

<p>When FILE is -, qi can read from the standard input.  See examples from
the <a href="#Packages">Packages</a> section.
</p>
<p>Exit status: 0 for a normal exit, 1 for minor common errors (help usage,
support not available, etc), 2 to indicate a command execution error;
3 for integrity check error on compressed files, 4 for empty, not
regular, or expected files, 5 for empty or not defined variables,
6 when a package already exist, 10 for network manager errors.
For more details, see the <a href="#Qi-exit-status">Qi exit status</a> section.
</p>

<hr>
<a name="The-qirc-file"></a>
<div class="header">
<p>
Next: <a href="#Packages" accesskey="n" rel="next">Packages</a>, Previous: <a href="#Invoking-qi" accesskey="p" rel="prev">Invoking qi</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="The-qirc-file-1"></a>
<h2 class="chapter">3 The qirc file</h2>
<a name="index-configuration-file"></a>

<p>The global <samp>qirc</samp> file offers a way to define variables and tools
(such as a download manager) for default use.  This file is used by qi
at runtime, e.g., to build, install, remove or upgrade packages.
</p>
<p>Variables and their possible values must be declared as any other
variable in the shell.
</p>
<p>The command line options related to the package directory and target
directory and some of the command line options used for the build command,
have the power to override the values declared on <samp>qirc</samp>.
See <a href="#Invoking-qi">Invoking qi</a>.
</p>
<p>The order in which qi looks for this file is:
</p>
<ol>
<li> <code>${HOME}/.qirc</code>
 Effective user.

</li><li> &lsquo;<samp>${sysconfdir}/qirc</samp>&rsquo;
 System-wide.
</li></ol>

<p>If you intend to run qi as effective user, the file
&lsquo;<samp>${sysconfdir}/qirc</samp>&rsquo; could be copied to <code>${HOME}/.qirc</code>
setting the paths for &lsquo;<samp>${packagedir}</samp>&rsquo; and &lsquo;<samp>${targetdir}</samp>&rsquo;
according to the <code>$HOME</code>.
</p>

<hr>
<a name="Packages"></a>
<div class="header">
<p>
Next: <a href="#Recipes" accesskey="n" rel="next">Recipes</a>, Previous: <a href="#The-qirc-file" accesskey="p" rel="prev">The qirc file</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Packages-1"></a>
<h2 class="chapter">4 Packages</h2>
<a name="index-managing-packages"></a>

<p>A package is a suite of programs usually distributed in binary form
which may also contain manual pages, documentation, or any other file
associated to a specific software.
</p>
<p>The package format used by qi is a simplified POSIX pax archive
compressed using lzip<a name="DOCF1" href="#FOOT1"><sup>1</sup></a>.  The
file extension for packages ends in &lsquo;<samp>.tlz</samp>&rsquo;.
</p>
<p>Both package installation and package de-installation are managed using
two important (internal) variables: &lsquo;<samp>${packagedir}</samp>&rsquo; and
&lsquo;<samp>${targetdir}</samp>&rsquo;, these values can be changed in the
configuration file or via options.
</p>
<p>&lsquo;<samp>${packagedir}</samp>&rsquo; is a common directory tree where the package
contents will be decompressed (will reside).
</p>
<p>&lsquo;<samp>${targetdir}</samp>&rsquo; is a target directory where the links will be
made by graft(1) taking &lsquo;<samp>${packagedir}/package_name</samp>&rsquo; into account.
</p>
<p>Packages are installed in self-contained directory trees and symbolic
links from a common area are made to the package files.  This allows
multiple versions of the same package to coexist on the same system.
</p>
<a name="Package-conflicts"></a>
<h3 class="section">4.1 Package conflicts</h3>
<a name="index-package-conflicts"></a>

<p>All the links to install or remove a package are handled by graft(1).
Since multiple packages can be installed or removed at the same time,
certain conflicts may arise between the packages.
</p>
<p>graft<a name="DOCF2" href="#FOOT2"><sup>2</sup></a>
defines a CONFLICT as one of the following conditions:
</p>
<ul>
<li> If the package object is a directory and the target object exists but is
not a directory.

</li><li> If the package object is not a directory and the target object exists
and is not a symbolic link.

</li><li> If the package object is not a directory and the target object exists
and is a symbolic link to something other than the package object.
</li></ul>

<p>The default behavior of qi for an incoming package is to ABORT if a
conflict arises.  When a package is going to be deleted, qi tells to
graft(1) to remove those parts that are not in conflict, leaving the
links to the belonging package.  This behavior can be forced if the
&ndash;prune option is given.
</p>
<a name="Installing-packages"></a>
<h3 class="section">4.2 Installing packages</h3>
<a name="index-package-installation"></a>

<p>To install a single package, simply type:
</p>
<div class="example">
<pre class="example">qi install coreutils_8.30_i586-1@tools.tlz
</pre></div>

<p>To install multiple packages at once, type:
</p>
<div class="example">
<pre class="example">qi install gcc_8.3.0_i586-1@devel.tlz rafaela_2.2_i586-1@legacy.tlz ...
</pre></div>

<p>Warn about the files that will be linked:
</p>
<div class="example">
<pre class="example">qi warn bash_5.0_i586-1@shells.tlz
</pre></div>

<p>This is to verify the content of a package before installing it.
</p>
<p>See the process of an installation:
</p>
<div class="example">
<pre class="example">qi install --verbose mariana_3.0_i586-1@woman.tlz
</pre></div>

<p>A second &ndash;verbose or -v option gives more (very verbose).
</p>
<p>Installing package in a different location:
</p>
<div class="example">
<pre class="example">qi install --rootdir=/media/floppy lzip_1.21_i586-1@compressors.tlz
</pre></div>

<p>Important: the &ndash;rootdir option assumes &lsquo;<samp>${targetdir}</samp>&rsquo; and
&lsquo;<samp>${packagedir}</samp>&rsquo;.  See the following example:
</p>
<div class="example">
<pre class="example">qi install --rootdir=/home/selk lzip_1.21_i586-1@compressors.tlz
</pre></div>

<p>The content of &quot;lzip_1.21_i586-1@compressors.tlz&quot; will be decompressed
into &lsquo;<samp>/home/selk/pkgs/lzip_1.21_i586-1@compressors</samp>&rsquo;.
Assuming that the main binary for lzip is under
&lsquo;<samp>/home/selk/pkgs/lzip_1.21_i586-1@compressors/usr/bin/</samp>&rsquo;
the target for &quot;usr/bin&quot; will be created at &lsquo;<samp>/home/selk</samp>&rsquo;.  Considering
that you have exported the <code>PATH</code> as &lsquo;<samp>${HOME}/usr/bin</samp>&rsquo;, now the
system is able to see the recent lzip command.
</p>
<p>Installing from a list of packages using standard input:
</p>
<div class="example">
<pre class="example">qi install - &lt; PACKAGELIST.txt
</pre></div>

<p>Or in combination with another tool:
</p><div class="example">
<pre class="example">sort -u PACKAGELIST.txt | qi install -
</pre></div>

<p>The sort command will read and sorts the list of declared packages,
while trying to have unique entries for each statement.  The output
produced is captured by Qi to install each package.
</p>
<p>An example of a list containing package names is:
</p><div class="example">
<pre class="example">/var/cache/qi/packages/amd64/tcl_8.6.9_amd64-1@devel.tlz
/var/cache/qi/packages/amd64/tk_8.6.9.1_amd64-1@devel.tlz
/var/cache/qi/packages/amd64/vala_0.42.3_amd64-1@devel.tlz
</pre></div>

<a name="Removing-packages"></a>
<h3 class="section">4.3 Removing packages</h3>
<a name="index-package-de_002dinstallation"></a>

<p>To remove a package, simply type:
</p>
<div class="example">
<pre class="example">qi remove xz_5.2.4_i586-1@compressors.tlz
</pre></div>

<p>Remove command will match the package name using &lsquo;<samp>${packagedir}</samp>&rsquo; as
prefix.  For example, if the value of &lsquo;<samp>${packagedir}</samp>&rsquo; has been
set to /usr/pkg, this will be equal to:
</p>
<div class="example">
<pre class="example">qi remove /usr/pkg/xz_5.2.4_i586-1@compressors
</pre></div>

<p>Detailed output:
</p>
<div class="example">
<pre class="example">qi remove --verbose /usr/pkg/xz_5.2.4_i586-1@compressors
</pre></div>

<p>A second &ndash;verbose or -v option gives more (very verbose).
</p>
<p>By default the remove command does not preserve a package directory after
removing its links from &lsquo;<samp>${targetdir}</samp>&rsquo;, but this behavior can be
changed if the &ndash;keep option is passed:
</p>
<div class="example">
<pre class="example">qi remove --keep /usr/pkg/lzip_1.21_i586-1@compressors
</pre></div>

<p>This means that the links to the package can be reactivated, later:
</p>
<div class="example">
<pre class="example">cd /usr/pkg &amp;&amp; graft -i lzip_1.21_i586-1@compressors
</pre></div>

<p>Removing package from a different location:
</p>
<div class="example">
<pre class="example">qi remove --rootdir=/home/cthulhu xz_5.2.4_i586-1@compressors
</pre></div>

<p>Removing a package using standard input:
</p>
<div class="example">
<pre class="example">echo vala_0.42.3_amd64-1@devel | qi remove -
</pre></div>

<p>This will match with the package directory.
</p>
<a name="Upgrading-packages"></a>
<h3 class="section">4.4 Upgrading packages</h3>
<a name="index-package-upgrade"></a>

<p>The upgrade command inherits the properties of the installation and removal
process.  To make sure that a package is updated, the package is installed
in a temporary directory taking &lsquo;<samp>${packagedir}</samp>&rsquo; into account.  Once
the incoming package is pre-installed, qi can proceed to search and delete
packages that have the same name (considered as previous ones).  Finally,
the package is re-installed at its final location and the temporary
directory is removed.
</p>
<p>Since updating a package can be crucial and so to perform a successful
upgrade, from start to finish, you will want to ignore some important
system signals during the upgrade process, those signals are SIGHUP,
SIGINT, SIGQUIT, SIGABRT, and SIGTERM.
</p>
<p>To upgrade a package, just type:
</p>
<div class="example">
<pre class="example">qi upgrade gcc_9.0.1_i586-1@devel.tlz
</pre></div>

<p>This will proceed to upgrade &quot;gcc_9.0.1_i586-1@devel&quot; removing any other
version of &quot;gcc&quot; (if any).
</p>
<p>If you want to keep the package directories of versions found during the
upgrade process, just pass:
</p>
<div class="example">
<pre class="example">qi upgrade --keep gcc_9.0.1_i586-1@devel.tlz
</pre></div>

<p>To see the upgrade process:
</p>
<div class="example">
<pre class="example">qi upgrade --verbose gcc_9.0.1_i586-1@devel.tlz
</pre></div>

<p>A second &ndash;verbose or -v option gives more (very verbose).
</p>
<p>To force the upgrade of an existing package:
</p>
<div class="example">
<pre class="example">qi upgrade --force gcc_9.0.1_i586-1@devel.tlz
</pre></div>

<a name="Package-blacklist"></a>
<h4 class="subsection">4.4.1 Package blacklist</h4>
<a name="index-package-blacklist"></a>

<p>To implement general package facilities, either to install, remove or
maintain the hierarchy of packages in a clean manner, qi makes use of the
pruning operation via graft(1) by default:
</p>
<p>There is a risk if those are crucial packages for the proper functioning
of the system, because it implies the deactivation of symbolic from the
target directory, <em>especially</em> when transitioning an incoming package
into its final location during an upgrade.
</p>
<p>A blacklist of package names has been devised for the case where
a user decides to upgrade all the packages in the system, or
just the crucial ones, such as the C library.
</p>
<p>The blacklist is related to the upgrade command only, consists in installing
a package instead of updating it or removing previous versions of it;
the content of the package will be updated over the existing content at
&lsquo;<samp>${packagedir}</samp>&rsquo;, while the existing links from
&lsquo;<samp>${targetdir}</samp>&rsquo; will be preserved.  A pruning of links will be
carried out in order to re-link possible differences with the recent
content, this helps to avoid leaving dead links in the target directory.
</p>
<p>Package names for the blacklist to be declared must be set from the
configuration file.  By default, it is declared using the package name,
which is more than enough for critical system packages, but if you want to
be more specific, you can declare a package using:
&lsquo;<samp>${pkgname}_${pkgversion}_${arch}-${release}</samp>&rsquo; where
the package category is avoided for common matching.  See
<a href="#Recipes">Special variables</a> for a description of these variables.
</p>
<hr>
<a name="Recipes"></a>
<div class="header">
<p>
Next: <a href="#Order-files" accesskey="n" rel="next">Order files</a>, Previous: <a href="#Packages" accesskey="p" rel="prev">Packages</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Recipes-1"></a>
<h2 class="chapter">5 Recipes</h2>
<a name="index-recipes"></a>

<p>A recipe is a file telling qi what to do.  Most often, the recipe tells
qi how to build a binary package from a source tarball.
</p>
<p>A recipe has two parts: a list of variable definitions and a list of
sections.  By convention, the syntax of a section is:
</p>
<div class="example">
<pre class="example">section_name()
{
    section lines
}
</pre></div>

<p>The section name is followed by parentheses, one newline and an opening
brace.  The line finishing the section contains just a closing brace.
The section names or the function names currently recognized are
&lsquo;<samp>build</samp>&rsquo;.
</p>
<p>The &lsquo;<samp>build</samp>&rsquo; section (or <strong>shell function</strong>) is an augmented
shell script that contains the main instructions to build software
from source.
</p>
<p>If there are other functions defined by the packager, Qi detects them
for later execution.
</p>
<a name="Variables"></a>
<h3 class="section">5.1 Variables</h3>
<a name="index-variables"></a>

<p>A &quot;variable&quot; is a <strong>shell variable</strong> defined either in <samp>qirc</samp>
or in a recipe to represent a string of text, called the variable&rsquo;s
&quot;value&quot;.  These values are substituted by explicit request in the
definitions of other variables or in calls to external commands.
</p>
<p>Variables can represent lists of file names, options to pass to
compilers, programs to run, directories to look in for source files,
directories to write output to, or anything else you can imagine.
</p>
<p>Definitions of variables in qi have four levels of precedence.
Options which define variables from the command-line override those
specified in the <samp>qirc</samp> file, while variables defined in the recipe
override those specified in <samp>qirc</samp>, taking priority over those
variables set by command-line options.  Finally, the variables have
default values if they are not defined anywhere.
</p>
<p>Options that set variables through the command-line can only reference
variables defined in <samp>qirc</samp> and variables with default values.
</p>
<p>Definitions of variables in <samp>qirc</samp> can only reference variables
previously defined in <samp>qirc</samp> and variables with default values.
</p>
<p>Definitions of variables in the recipe can only reference variables
set by the command-line, variables previously defined in the recipe,
variables defined in <samp>qirc</samp>, and variables with default values.
</p>
<a name="Special-variables"></a>
<h3 class="section">5.2 Special variables</h3>
<a name="index-special-variables"></a>

<p>There are variables which can only be set using the command line options or
via <samp>qirc</samp>, there are other special variables which can be defined or
redefined in a recipe.  See the following definitions:
</p>
<p>&lsquo;<samp>outdir</samp>&rsquo; is the directory where the packages produced are written.
This variable can be redefined per-recipe.  Default sets to
&lsquo;<samp>/var/cache/qi/packages</samp>&rsquo;.
</p>
<p>&lsquo;<samp>worktree</samp>&rsquo; is the working tree where archives, patches, and recipes
are expected.  This variable can not be redefined in the recipe.  Default
sets to &lsquo;<samp>/usr/src/qi</samp>&rsquo;.
</p>
<p>&lsquo;<samp>tardir</samp>&rsquo; is defined in the recipe to the directory where the tarball
containing the source can be found.  The full name of the tarball is
composed as &lsquo;<samp>${tardir}/$tarname</samp>&rsquo;.  Its value is available in the
recipe as &lsquo;<samp>${tardir}</samp>&rsquo;; a value of . for &lsquo;<samp>tardir</samp>&rsquo; sets it to
the value of CWD (Current Working Directory), this is where the recipe
lives.
</p>
<p>&lsquo;<samp>arch</samp>&rsquo; is the architecture to compose the package name.  Its value is
available in the recipe as &lsquo;<samp>${arch}</samp>&rsquo;.  Default value is the one
that was set in the Qi configuration.
</p>
<p>&lsquo;<samp>jobs</samp>&rsquo; is the number of parallel jobs to pass to the compiler.  Its
value is available in the recipe as &lsquo;<samp>${jobs}</samp>&rsquo;.  The default value
is 1.
</p>
<p>The two variables &lsquo;<samp>${srcdir}</samp>&rsquo; and &lsquo;<samp>${destdir}</samp>&rsquo; can be
set in the recipe, as any other variable, but if they are not, qi uses
default values for them when building a package.
</p>
<p>&lsquo;<samp>srcdir</samp>&rsquo; contains the source code to be compiled, and defaults to
&lsquo;<samp>${program}-${version}</samp>&rsquo;.  &lsquo;<samp>destdir</samp>&rsquo; is the place where the
built package will be installed, and defaults to
&lsquo;<samp>${TMPDIR}/package-${program}</samp>&rsquo;.
</p>
<p>If &lsquo;<samp>pkgname</samp>&rsquo; is left undefined, the special variable &lsquo;<samp>program</samp>&rsquo;
is assigned by default.  If &lsquo;<samp>pkgversion</samp>&rsquo; is left undefined, the
special variable &lsquo;<samp>version</samp>&rsquo; is assigned by default.
</p>
<p>&lsquo;<samp>pkgname</samp>&rsquo; and &lsquo;<samp>pkgversion</samp>&rsquo; along with: &lsquo;<samp>version</samp>&rsquo;, &lsquo;<samp>arch</samp>&rsquo;,
&lsquo;<samp>release</samp>&rsquo;, and (optionally) &lsquo;<samp>pkgcategory</samp>&rsquo; are used to produce the
package name in the form:
&lsquo;<samp>${pkgname}_${pkgversion}_${arch}-${release}[@${pkgcategory}].tlz</samp>&rsquo;
</p>
<p>&lsquo;<samp>pkgcategory</samp>&rsquo; is an optional special variable that can be defined on the
recipe to categorize the package name.  If it is defined, then the
package output will be composed as
&lsquo;<samp>${pkgname}_${pkgversion}_${arch}-${release}[@${pkgcategory}.tlz</samp>&rsquo;.
Automatically, the value of &lsquo;<samp>pkgcategory</samp>&rsquo; will be prefixed using the
&lsquo;<samp>@</samp>&rsquo; (at) symbol which will be added to the last part of the package name.
</p>
<p>A special variable called &lsquo;<samp>replace</samp>&rsquo; can be used to declare package names
that will be replaced at installation time.
</p>
<p>The special variables &lsquo;<samp>keep_srcdir</samp>&rsquo; and &lsquo;<samp>keep_destdir</samp>&rsquo; are provided
in order to preserve the directories &lsquo;<samp>${srcdir}</samp>&rsquo; or &lsquo;<samp>${destdir}</samp>&rsquo;,
if those exists as such.  Note: The declaration of these variables are subject
to manual deactivation; its purpose in recipes is to preserve the directories
that relate to the package&rsquo;s build (source) and destination directory, that is
so that another recipe can get a new package (or meta package) from there.  For
example, the declarations can be done as:
</p>
<div class="example">
<pre class="example">keep_srcdir=keep_srcdir
keep_destdir=keep_destdir
</pre></div>

<p>Then from another recipe you would proceed to copy the necessary files that
will compose the meta package, from the main function you must deactivate
the variables at the end:
</p>
<div class="example">
<pre class="example">unset -v keep_srcdir keep_destdir
</pre></div>

<p>This will leave the &rsquo;keep_srcdir&rsquo; and &rsquo;keep_destdir&rsquo; variables blank to
continue with the rest of the recipes.
</p>
<p>A typical recipe contains the following variables:
</p>
<ul>
<li> &lsquo;<samp>program</samp>&rsquo;: Software name.

<p>It matches the source name.  It is also used to compose the name of the
package if &lsquo;<samp>${pkgname}</samp>&rsquo; is not specified.
</p>
</li><li> &lsquo;<samp>version</samp>&rsquo;: Software version.

<p>It matches the source name.  It is also used to compose the version of the
package if &lsquo;<samp>${pkgversion}</samp>&rsquo; is not specified.
</p>
</li><li> &lsquo;<samp>arch</samp>&rsquo;: Software architecture.

<p>It is used to compose the architecture of the package in which it is
build.
</p>
</li><li> &lsquo;<samp>release</samp>&rsquo;: Release number.

<p>This is used to reflect the release number of the package.  It is
recommended to increase this number after any significant change in
the recipe or post-install script.
</p>
</li><li> &lsquo;<samp>pkgcategory</samp>&rsquo;: Package category.

<p>Optional but recommended variable to categorize the package name when it is
created.
</p></li></ul>

<p>Obtaining sources over the network must be declared in the recipe using
the &lsquo;<samp>fetch</samp>&rsquo; variable.
</p>
<p>The variables &lsquo;<samp>netget</samp>&rsquo; and &lsquo;<samp>rsync</samp>&rsquo; can be defined in <samp>qirc</samp>
to establish a network downloader in order to get the sources.  If they
are not defined, qi uses default values:
</p>
<p>&lsquo;<samp>netget</samp>&rsquo; is the general network downloader tool, defaults sets to
&lsquo;<samp>wget2 -c -w1 -t3 --no-check-certificate</samp>&rsquo;.
</p>
<p>&lsquo;<samp>rsync</samp>&rsquo; is the network tool for sources containing the prefix for
the RSYNC protocol, default sets to
&lsquo;<samp>rsync -v -a -L -z -i --progress</samp>&rsquo;.
</p>
<p>The variable &lsquo;<samp>description</samp>&rsquo; is used to print the package description
when a package is installed.
</p>
<p>A description has two parts: a brief description, and a long description.
By convention, the syntax of &lsquo;<samp>description</samp>&rsquo; is:
</p>
<div class="example">
<pre class="example">description=&quot;
Brief description.

Long description.
&quot;
</pre></div>

<p>The first line of the value represented is a brief description of the
software (called &quot;blurb&quot;).  A blank line separates the <em>brief
description</em> from the <em>long description</em>, which should contain a more
descriptive description of the software.
</p>
<p>An example looks like:
</p>
<div class="example">
<pre class="example">description=&quot;
The GNU core utilities.

The GNU core utilities are the basic file, shell and text manipulation
utilities of the GNU operating system.  These are the core utilities
which are expected to exist on every operating system.
&quot;
</pre></div>

<p>Please consider a length limit of 78 characters as maximum, because the same
one would be used on the meta file creation.  See
<a href="#Recipes">The meta file</a> section.
</p>
<p>The &lsquo;<samp>homepage</samp>&rsquo; variable is used to declare the main site or home page:
</p>
<div class="example">
<pre class="example">homepage=https://www.gnu.org/software/gcc
</pre></div>

<p>The variable &lsquo;<samp>license</samp>&rsquo; is used for license information<a name="DOCF3" href="#FOOT3"><sup>3</sup></a>.
Some code in the program can be covered by license A, license B, or
license C.  For &quot;separate licensing&quot; or &quot;heterogeneous licensing&quot;, we
suggest using <strong>|</strong> for a disjunction, <strong>&amp;</strong> for a conjunction
(if that ever happens in a significant way), and comma for heterogeneous
licensing.  Comma would have lower precedence, plus added special terms.
</p>
<div class="example">
<pre class="example">license=&quot;LGPL, GPL | Artistic - added permission&quot;
</pre></div>

<a name="Writing-recipes"></a>
<h3 class="section">5.3 Writing recipes</h3>
<a name="index-writing-recipes"></a>

<p>Originally, Qi was designed for the series of Dragora GNU/Linux-Libre 3;
this doesn&rsquo;t mean you can&rsquo;t use it in another distribution, just that if
you do, you&rsquo;ll have to try it out for yourself. To help with this, here
are some references to well-written recipes:
</p>
<ul>
<li> <a href="https://git.savannah.nongnu.org/cgit/dragora.git/tree/recipes">https://git.savannah.nongnu.org/cgit/dragora.git/tree/recipes</a>
</li><li> <a href="https://notabug.org/dragora/dragora/src/master/recipes">https://notabug.org/dragora/dragora/src/master/recipes</a>
</li><li> <a href="https://notabug.org/dragora/dragora-extras/src/master/recipes">https://notabug.org/dragora/dragora-extras/src/master/recipes</a>
</li><li> <a href="https://git.savannah.nongnu.org/cgit/dragora/dragora-extras.git/tree/recipes">https://git.savannah.nongnu.org/cgit/dragora/dragora-extras.git/tree/recipes</a>
</li></ul>

<a name="Building-packages"></a>
<h3 class="section">5.4 Building packages</h3>
<a name="index-package-build"></a>

<p>A recipe is any valid regular file.  Qi sets priorities for reading a
recipe, the order in which qi looks for a recipe is:
</p>
<ol>
<li> Current working directory.

</li><li> If the specified path name does not contain &quot;recipe&quot; as the last
component.  Qi will complete it by adding &quot;recipe&quot; to the path name.

</li><li> If the recipe is not in the current working directory, it will be
searched under &lsquo;<samp>${worktree}/recipes</samp>&rsquo;.  The last component will be
completed adding &quot;recipe&quot; to the specified path name.
</li></ol>

<p>To build a single package, type:
</p>
<div class="example">
<pre class="example">qi build x-apps/xterm
</pre></div>

<p>Multiple jobs can be passed to the compiler to speed up the build process:
</p>
<div class="example">
<pre class="example">qi build --jobs 3 x-apps/xterm
</pre></div>

<p>Update or install the produced package (if not already installed) when the
build command ends:
</p>
<div class="example">
<pre class="example">qi build -j3 --upgrade x-apps/xterm
</pre></div>

<p>Only process a recipe but do not create the binary package:
</p>
<div class="example">
<pre class="example">qi build --no-package dict/aspell
</pre></div>

<p>The options &ndash;install or &ndash;upgrade have no effect when &ndash;no-package
is given.
</p>
<p>This is useful to inspect the build process of the above recipe:
</p>
<p>qi build &ndash;keep &ndash;no-package dict/aspell 2&gt;&amp;1 | tee aspell-log.txt
</p>
<p>The &ndash;keep option could preserve the source directory and the destination
directory for later inspection.  A log file of the build process will be
created redirecting both, standard error and standard output to tee(1).
</p>
<a name="Variables-from-the-environment"></a>
<h3 class="section">5.5 Variables from the environment</h3>
<a name="index-environment-variables"></a>

<p>Qi has environment variables which can be used at build time:
</p>
<p>The variable <code>TMPDIR</code> sets the temporary directory for sources, which is
used for package extractions (see <a href="#Examining-packages">Examining packages</a>) and is
prepended to the value of &lsquo;<samp>${srcdir}</samp>&rsquo; and &lsquo;<samp>${destdir}</samp>&rsquo; in
build command.  By convention its default value is equal to
&lsquo;<samp>/usr/src/qi/build</samp>&rsquo;.
</p>
<p>The variables <code>QICFLAGS</code>, <code>QICXXFLAGS</code>, <code>QILDFLAGS</code>, and
<code>QICPPFLAGS</code> have no effect by default.  The environment variables
such as <code>CFLAGS</code>, <code>CXXFLAGS</code>, <code>LDFLAGS</code>, and <code>CPPFLAGS</code>
are unset at compile time:
</p>
<p>Recommended practice is to set variables in the command line of
&lsquo;<samp>configure</samp>&rsquo; or <em>make(1)</em> instead of exporting to the
environment.  As follows:
</p>
<p><a href="https://www.gnu.org/software/make/manual/html_node/Environment.html">https://www.gnu.org/software/make/manual/html_node/Environment.html</a>
</p><blockquote>
<p>It is not wise for makefiles to depend for their functioning on environment
variables set up outside their control, since this would cause different
users to get different results from the same makefile.  This is against the
whole purpose of most makefiles.
</p></blockquote>

<p>Setting environment variables for configure is deprecated because running
configure in varying environments can be dangerous.
</p>
<p><a href="https://gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Defining-Variables.html">https://gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Defining-Variables.html</a>
</p><blockquote>
<p>Variables not defined in a site shell script can be set in the environment
passed to configure.  However, some packages may run configure again
during the build, and the customized values of these variables may be
lost.  In order to avoid this problem, you should set them in the
configure command line, using &lsquo;<samp>VAR=value</samp>&rsquo;.  For example:
</p>
<p><code>./configure CC=/usr/local2/bin/gcc</code>
</p></blockquote>

<p><a href="https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Setting-Output-Variables.html">https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Setting-Output-Variables.html</a>
</p><blockquote>
<p>If for instance the user runs &lsquo;<samp>CC=bizarre-cc ./configure</samp>&rsquo;, then the cache,
config.h, and many other output files depend upon bizarre-cc being the C
compiler.  If for some reason the user runs ./configure again, or if it is
run via &lsquo;<samp>./config.status --recheck</samp>&rsquo;, (See Automatic Remaking, and see
config.status Invocation), then the configuration can be inconsistent,
composed of results depending upon two different compilers.
[...]
Indeed, while configure can notice the definition of CC in &lsquo;<samp>./configure
CC=bizarre-cc</samp>&rsquo;, it is impossible to notice it in &lsquo;<samp>CC=bizarre-cc
./configure</samp>&rsquo;, which, unfortunately, is what most users do.
[...]
configure: error: changes in the environment can compromise the build.
</p></blockquote>

<p>If the <code>SOURCE_DATE_EPOCH</code> environment variable is set to a UNIX timestamp
(defined as the number of seconds, excluding leap seconds, since 01 Jan 1970
00:00:00 UTC.); then the given timestamp will be used to overwrite any newer
timestamps on the package contents (when it is created).  More information
about this can be found at
<a href="https://reproducible-builds.org/specs/source-date-epoch/">https://reproducible-builds.org/specs/source-date-epoch/</a>.
</p>
<a name="The-meta-file"></a>
<h3 class="section">5.6 The meta file</h3>
<a name="index-the-meta-file"></a>

<p>The &quot;meta file&quot; is a regular file created during the build process, it
contains information about the package such as package name, package
version, architecture, release, fetch address, description, and other
minor data extracted from processed recipes.  The name of the file is
generated as &lsquo;<samp>${full_pkgname}.tlz.txt</samp>&rsquo;, and its purpose is to
reflect essential information to the user without having to look inside
the package content.  The file format is also intended to be used by
other scripts or by common Unix tools.
</p>
<p>The content of a meta file looks like:
</p>
<div class="example">
<pre class="example">#
# Pattern scanning and processing language.
#
# The awk utility interprets a special-purpose programming language
# that makes it possible to handle simple data-reformatting jobs
# with just a few lines of code.  It is a free version of 'awk'.
#
# GNU awk implements the AWK utility which is part of
# IEEE Std 1003.1 Shell and Utilities (XCU).
#

QICFLAGS=&quot;-O2&quot;
QICXXFLAGS=&quot;-O2&quot;
QILDFLAGS=&quot;&quot;
QICPPFLAGS=&quot;&quot;
pkgname=gawk
pkgversion=5.0.1
arch=amd64
release=1
pkgcategory=&quot;tools&quot;
full_pkgname=gawk_5.0.1_amd64-1@tools
blurb=&quot;Pattern scanning and processing language.&quot;
homepage=&quot;https://www.gnu.org/software/gawk&quot;
license=&quot;GPLv3+&quot;
fetch=&quot;https://ftp.gnu.org/gnu/gawk/gawk-5.0.1.tar.lz&quot;
replace=&quot;&quot;
</pre></div>

<p>A package descriptions is extracted from the variable &lsquo;<samp>description</samp>&rsquo;
where each line is interpreted literally and pre-formatted to fit in
(exactly) <strong>80 columns</strong>, plus the character &lsquo;<samp>#</samp>&rsquo; and a blank
space is prefixed to every line (shell comments).
</p>
<p>In addition to the Special variables, there are implicit variables such as
&lsquo;<samp>blurb</samp>&rsquo;:
</p>
<p>The &lsquo;<samp>blurb</samp>&rsquo; variable is related to the special variable
&lsquo;<samp>description</samp>&rsquo;.  Its value is made from the first (substantial)
line of &lsquo;<samp>description</samp>&rsquo;, mentioned as the &quot;brief description&quot;.
</p>
<p>The build flags such as &lsquo;<samp>QICFLAGS</samp>&rsquo;, &lsquo;<samp>QICXXFLAGS</samp>&rsquo;,
&lsquo;<samp>QILDFLAGS</samp>&rsquo;, and &lsquo;<samp>QICPPFLAGS</samp>&rsquo; are only added to the meta file
if the declared variable &lsquo;<samp>arch</samp>&rsquo; is not equal to the &quot;noarch&quot; value.
</p>
<hr>
<a name="Order-files"></a>
<div class="header">
<p>
Next: <a href="#Creating-packages" accesskey="n" rel="next">Creating packages</a>, Previous: <a href="#Recipes" accesskey="p" rel="prev">Recipes</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Order-files-1"></a>
<h2 class="chapter">6 Order files</h2>
<a name="index-handling-build-order"></a>

<p>The order command has the purpose of resolving the build order through
.order files.  An order file contains a list of recipe names, by default
does not perform any action other than to print a resolved list in
descending order.  For example, if <strong>a</strong> depends on <strong>b</strong> and
<strong>c</strong>, and <strong>c</strong> depends on <strong>b</strong> as well, the file might
look like:
</p>
<div class="example">
<pre class="example">a: c b
b:
c: b
</pre></div>

<p>Each letter represents a recipe name, complete dependencies for
the first recipe name are listed in descending order, which is
printed from right to left, and removed from left to right:
</p>
<p><small>OUTPUT</small>
</p>
<div class="example">
<pre class="example">b
c
a
</pre></div>

<p>Blank lines, colons and parentheses are simply ignored.  Comment lines
beginning with &lsquo;<samp>#</samp>&rsquo; are allowed.
</p>
<p>An order file could be used to build a series of packages, for example,
if the content is:
</p>
<div class="example">
<pre class="example"># Image handling libraries

libs/libjpeg-turbo: devel/nasm
x-libs/jasper: libs/libjpeg-turbo
libs/tiff: libs/libjpeg-turbo
</pre></div>

<p>To proceed with each recipe, we can type:
</p>
<div class="example">
<pre class="example">qi order imglibs.order | qi build --install -
</pre></div>

<p>The output of &lsquo;<samp>qi order imglibs.order</samp>&rsquo; tells to qi in which order it
should build the recipes:
</p>
<div class="example">
<pre class="example">devel/nasm
libs/libjpeg-turbo
x-libs/jasper
libs/tiff
</pre></div>


<hr>
<a name="Creating-packages"></a>
<div class="header">
<p>
Next: <a href="#Examining-packages" accesskey="n" rel="next">Examining packages</a>, Previous: <a href="#Order-files" accesskey="p" rel="prev">Order files</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Creating-packages-1"></a>
<h2 class="chapter">7 Creating packages</h2>
<a name="index-package-creation"></a>

<p>The creation command is an internal function of qi to make new Qi
compatible packages.  A package is produced using the contents of
the Current Working Directory and the package file is written out.
</p>
<div class="example">
<pre class="example">Usage: qi create [<var>Output/PackageName.tlz</var>]...
</pre></div>

<p>The argument for the file name to be written must contain a fully
qualified named directory as the output directory where the package
produced will be written.  The file name should be composed using the
full name: name-version-architecture-release[@pkgcategory].tlz
</p>
<p><small>EXAMPLE</small>
</p>
<div class="example">
<pre class="example">cd /usr/pkg
cd claws-mail_3.17.1_amd64-1@x-apps
qi create /var/cache/qi/packages/claws-mail_3.17.1_amd64-1@x-apps
</pre></div>

<p>In this case, the package &quot;claws-mail_3.17.1_amd64-1@x-apps&quot; will be
written into &lsquo;<samp>/var/cache/qi/packages/</samp>&rsquo;.
</p>
<p>All packages produced are complemented by a checksum file (.sha256).
</p>

<hr>
<a name="Examining-packages"></a>
<div class="header">
<p>
Next: <a href="#Qi-exit-status" accesskey="n" rel="next">Qi exit status</a>, Previous: <a href="#Creating-packages" accesskey="p" rel="prev">Creating packages</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Examining-packages-1"></a>
<h2 class="chapter">8 Examining packages</h2>
<a name="index-package-examination"></a>

<p>The extraction command serves to examine binary packages for debugging
purposes. It decompresses a package into a single directory, verifying
its integrity and preserving all of its properties (owner and permissions).
</p>
<div class="example">
<pre class="example">Usage: qi extract [<var>packagename.tlz</var>]...
</pre></div>

<p><small>EXAMPLE</small>
</p>
<div class="example">
<pre class="example">qi extract mksh_R56c_amd64-1@shells.tlz
</pre></div>

<p>This action will put the content of &quot;mksh_R56c_amd64-1@shells.tlz&quot; into a
single directory, this is a private directory for the user who requested
the action, creation operation will be equal to <strong>u=rwx,g=,o= (0700)</strong>.
The package content will reside on this location, default mask to deploy
the content will be equal to <strong>u=rwx,g=rwx,o=rwx (0000)</strong>.
</p>
<p>Note: the creation of the custom directory is influenced by the value
of the <code>TMPDIR</code> variable.
</p>

<hr>
<a name="Qi-exit-status"></a>
<div class="header">
<p>
Next: <a href="#Index" accesskey="n" rel="next">Index</a>, Previous: <a href="#Examining-packages" accesskey="p" rel="prev">Examining packages</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Qi-exit-status-1"></a>
<h2 class="chapter">9 Qi exit status</h2>
<a name="index-exit-codes"></a>

<p>All the exit codes are described in this chapter.
</p>
<dl compact="compact">
<dt>&lsquo;<samp>0</samp>&rsquo;</dt>
<dd><p>Successful completion (no errors).
</p>
</dd>
<dt>&lsquo;<samp>1</samp>&rsquo;</dt>
<dd><p>Minor common errors:
</p>
<ul>
<li> Help usage on invalid options or required arguments.

</li><li> Program needed by qi (prerequisite) is not available.
</li></ul>

</dd>
<dt>&lsquo;<samp>2</samp>&rsquo;</dt>
<dd><p>Command execution error:
</p>
<p>This code is used to return the evaluation of an external command or shell
arguments in case of failure.
</p>
</dd>
<dt>&lsquo;<samp>3</samp>&rsquo;</dt>
<dd><p>Integrity check error for compressed files.
</p>
<p>Compressed files means:
</p>
<ul>
<li> A tarball file from tar(1).
Supported extensions: .tar, .tar.gz, .tgz, .tar.Z, .tar.bz2, .tbz2, .tbz,
.tar.xz, .txz

</li><li> A tarball file from tarlz(1).
Supported extensions: .tar.lz, .tlz

</li><li> Zip files from unzip(1).
Supported extensions: .zip, .ZIP

</li><li> Gzip files from gzip(1).
Supported extensions: .gz, .Z

</li><li> Bzip2 files from bzip2(1).
Supported extension: .bz2

</li><li> Lzip files from lzip(1).
Supported extension: .lz

</li><li> Xz files from xz(1).
Supported extension: .xz
</li></ul>

</dd>
<dt>&lsquo;<samp>4</samp>&rsquo;</dt>
<dd><p>File empty, not regular, or expected.
</p>
<p>It&rsquo;s commonly expected:
</p>
<ul>
<li> An argument for giving commands.

</li><li> A regular file or readable directory.

</li><li> An expected extension: .tlz, .sha256, .order.

</li><li> A protocol supported by the network downloader tool.
</li></ul>

</dd>
<dt>&lsquo;<samp>5</samp>&rsquo;</dt>
<dd><p>Empty or not defined variable:
</p>
<p>This code is used to report empty or undefined variables (usually
variables coming from a recipe or assigned arrays that are tested).
</p>
</dd>
<dt>&lsquo;<samp>6</samp>&rsquo;</dt>
<dd><p>Package already installed:
</p>
<p>The package directory for an incoming .tlz package already exists.
</p>
</dd>
<dt>&lsquo;<samp>10</samp>&rsquo;</dt>
<dd><p>Network manager error:
</p>
<p>This code is used if the network downloader tool fails for some reason.
</p></dd>
</dl>


<hr>
<a name="Index"></a>
<div class="header">
<p>
Previous: <a href="#Qi-exit-status" accesskey="p" rel="prev">Qi exit status</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Index-1"></a>
<h2 class="unnumbered">Index</h2>

<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Index_cp_letter-C"><b>C</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-E"><b>E</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-H"><b>H</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-I"><b>I</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-M"><b>M</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-P"><b>P</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-R"><b>R</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-S"><b>S</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-T"><b>T</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-V"><b>V</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-W"><b>W</b></a>
 &nbsp; 
</td></tr></table>
<table class="index-cp" border="0">
<tr><td></td><th align="left">Index Entry</th><td>&nbsp;</td><th align="left"> Section</th></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-C">C</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-configuration-file">configuration file</a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-qirc-file">The qirc file</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-E">E</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-environment-variables">environment variables</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-exit-codes">exit codes</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Qi-exit-status">Qi exit status</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-H">H</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-handling-build-order">handling build order</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Order-files">Order files</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-I">I</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-introduction-to-qi">introduction to qi</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Introduction-to-Qi">Introduction to Qi</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-invocation">invocation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Invoking-qi">Invoking qi</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-M">M</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-managing-packages">managing packages</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-P">P</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-package-blacklist">package blacklist</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package-build">package build</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package-conflicts">package conflicts</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package-creation">package creation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Creating-packages">Creating packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package-de_002dinstallation">package de-installation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package-examination">package examination</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Examining-packages">Examining packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package-installation">package installation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package-upgrade">package upgrade</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-R">R</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-recipes">recipes</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-S">S</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-special-variables">special variables</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-T">T</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-the-meta-file">the meta file</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-V">V</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-variables">variables</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Index_cp_letter-W">W</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-writing-recipes">writing recipes</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
</table>
<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Index_cp_letter-C"><b>C</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-E"><b>E</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-H"><b>H</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-I"><b>I</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-M"><b>M</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-P"><b>P</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-R"><b>R</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-S"><b>S</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-T"><b>T</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-V"><b>V</b></a>
 &nbsp; 
<a class="summary-letter" href="#Index_cp_letter-W"><b>W</b></a>
 &nbsp; 
</td></tr></table>

<div class="footnote">
<hr>
<h4 class="footnotes-heading">Footnotes</h4>

<h3><a name="FOOT1" href="#DOCF1">(1)</a></h3>
<p>For more details about tarlz and the
lzip format, visit <a href="https://lzip.nongnu.org/tarlz.html">https://lzip.nongnu.org/tarlz.html</a>.</p>
<h3><a name="FOOT2" href="#DOCF2">(2)</a></h3>
<p>The official guide for Graft can be found at
<a href="https://peters.gormand.com.au/Home/tools/graft/graft.html">https://peters.gormand.com.au/Home/tools/graft/graft.html</a>.</p>
<h3><a name="FOOT3" href="#DOCF3">(3)</a></h3>
<p>The proposal for &lsquo;<samp>license</samp>&rsquo; was made by Richard M. Stallman at
<a href="https://lists.gnu.org/archive/html/gnu-linux-libre/2016-05/msg00003.html">https://lists.gnu.org/archive/html/gnu-linux-libre/2016-05/msg00003.html</a>.</p>
</div>
<hr>



</body>
</html>
